#pragma once
#include <vector>
#include <string>
#include <iostream>
#include <libpq-fe.h>
#include "predicate.h"

using namespace std;

class Table {
public:
	string table_name;
	vector<string> column_names;
	vector<vector<string>> values;
	bool dblocal;
	
	void input_data(PGconn* conn,string tablename ,string sql,vector<string> col_names);

	void table_foreignkey_join(Table& t1,string t1col, Table& t2,string t2col, Table& res); //foreign key belongs to t1

	void table_print(int limit);

	void table_normal_join(Table& t1, Table& t2, Table& res);

	void add_tracebit();

	void execute_where(Predicate& pred);

	void orderby_Col(string orderby_col);
};
